<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>LAnimation</title>
	<script type="text/javascript" src="../../lufylegend-1.8.12.simple.min.js"></script>
	</head>
	<body>
			<div id="legend"></div>
			<script type="text/javascript">
				init(100,"legend",800,450,main);
				var imgData = [
					{name:"player",path:"player.png"}
				];
				var imglist;
				var backLayer,hero,index=0;
				function main(){
					LLoadManage.load(imgData,null,gameInit);
				}
				function gameInit(result){
					LGlobal.setDebug(true);
					imglist = result;
					backLayer = new LSprite();
					addChild(backLayer);
					var list = LGlobal.divideCoordinate(256,256,4,4);
					var data = new LBitmapData(imglist["player"],0,0,64,64);
					hero = new LAnimation(backLayer,data,list);
					
					backLayer.addEventListener(LEvent.ENTER_FRAME,onframe);
					hero.addEventListener(LEvent.COMPLETE,oncomplete);
				}
				function onframe(){
					hero.onframe();
				}
				//LEvent.COMPLETE事件接受一个参数，参数就是对象本身
				function oncomplete(e){
					//利用debug模式输出ok，表示事件被触发
					trace("ok");
				}
			</script>
			
			
			
	</body>
</html>
